package com.bgds.sys.task;

import org.quartz.Scheduler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.stereotype.Component;

/**
 * @Description TODO
 * @Author lj
 * @create: 2020-09-07 16:24
 */
@Component
public class SchedulerConfig {
    @Autowired
    private SchedulerFactoryBean schedulerFactoryBean;

    /**
     * 初始化调度器，注入容器
     * @return
     */
    @Bean
    public Scheduler scheduler(){
        Scheduler scheduler = schedulerFactoryBean.getScheduler();
        return scheduler;
    }
}
